import { Controller, Get } from '@nestjs/common';
import { UserService } from './modules/user/user.service';
import { User } from './modules/user/models/user.entity';
import { AppService } from './app.service';

@Controller()
export class AppController {
  constructor(
    private readonly userService: UserService,
    private readonly appService: AppService,
  ) {}

  @Get('/create')
  async create(id: string): Promise<boolean> {
    return await this.userService.create({
      id,
      name: '水滴超级管理员',
      desc: '管理员',
      tel: '13812546859',
    });
  }

  @Get('/del')
  async del(): Promise<boolean> {
    return await this.userService.del('5679ae1f-2ef2-4f09-ac58-bfed6551f257');
  }

  @Get('/update')
  async update(): Promise<boolean> {
    return await this.userService.update(
      'a3bc560b-09cb-4fcf-a642-2360f8afd134',
      {
        name: '水滴超级管理员111',
      },
    );
  }

  @Get('/find')
  async find(id: string): Promise<User> {
    return await this.userService.find(id);
  }

  @Get('/getHello')
  async getHello(): Promise<string> {
    return await this.appService.getHello();
  }
}
